import '../css/details.css';
import {useEffect, useState} from "react";
import request from "../utils/request";

export default ()=>{

    const [Details,setDetails] = useState({ });



    const getDetails = async () => {
        let _id = window.location.search.slice(4);
        const {data} = await request.post(`/mseeagedetail`,{
            _id
        });
        setDetails(data.data)
    }

    const time2txt = (time)=>{
        time = time.slice(0,10);
        return time;
    }

    useEffect(()=>{
        getDetails();
    },[])

    return (
        <div style={{width:'100%'}}>
            <div className='details'>
                <div className='header'>
                    <h2 className='p1'> { Details.title && Details.title} </h2>
                    <div className='box4'>
                        <span className='p2'> { Details.author && Details.author} </span>
                        <span className='p3'> { Details.createdAt && Details.createdAt.slice(0,10)} </span>
                    </div>
                </div>
                <div className='content1'>
                    <img src={ Details.cover && Details.cover}></img>
                    <div className='msg'>
                        {Details.msg}
                    </div>
                </div>
            </div>


            {

                // console.log(window.location.search.slice(4))
                // console.log(window.location.search.substr(4))
            }
        </div>
    )
}